/*
 * File: exercise11.cpp
 * -------------------
 * Leibniz's series to get PI/4
 * compile command :
 * g++ -Wall -g exercise11.cpp -o exercise11 -lStanfordCPPLib -I ../include/
 */

#include <iostream>
#include <cmath>
using namespace std;

const int TIMES = 10000;

int main()
{
	double P = 0;
	for(int i = 1; i <= TIMES; i++)
	{
		P += (double)pow(-1, i+1)/double(2*i -1);
	}
	cout<<"Leibniz's series = " <<P<<endl;
	cout<<"PI = " <<4*P<<endl;
	return 0;
}
